/*
 * InstructionC7.java
 *
 * Created on March 21, 2007, 9:42 PM
 *
 *  CLRB 0=>B Clear Accumulator B
 *  Addressing mode INH
 *
 */

package moto9s12sim;

/**
 *
 * @author Fergus Earnshaw
 */
public class InstructionC7 extends Instruction{
    
    /** Creates a new instance of InstructionC7 */
    public InstructionC7()
    {
        this.strAssemblyCode = "CLRB";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("C7",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        cpu.PC.inc();
        
        //clear register
        cpu.A.setRegister((byte)0);
        
        //set flags
        cpu.CC.setN(false);
        cpu.CC.setZ(true);
        cpu.CC.setV(false);
        cpu.CC.setC(false);
        
        printInstruction(cpu);
        //I think the first invalid instruction should halt excution
        return true;
    }
}
